package cn.dansj.service;

import cn.dansj.bean.FileUploadInfo;
import cn.dansj.common.utils.bean.Return;
import cn.dansj.common.utils.enums.CreateBucket;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.util.List;
import java.util.Map;

public interface MinioUploadService {
    /**
     * 分片上传初始化
     *
     * @return Map<String, Object>
     */
    Return<?> initMultiPartUpload(FileUploadInfo fileUploadInfo);

    /**
     * 完成分片上传
     *
     * @return String
     */
    String mergeMultipartUpload(FileUploadInfo fileUploadInfo);

    /**
     * 通过 md5 获取已上传的数据
     *
     * @param md5 String
     * @return Mono<Map < String, Object>>
     */
    Return<?> checkFileMd5(String md5, String filename, String bucket);

    /**
     * 获取文件地址
     */
    String getFilePath(String bucketName, String fileName);


    /**
     * 单文件上传
     */
    String upload(MultipartFile file, String bucketName, String filename) throws IOException;

    String saveUploadFileInfo(FileUploadInfo fileUploadInfo);

    List<Map<String, Object>> getTagInfo();

    CreateBucket createBucket(String bucket);

    boolean deleteBucket(String bucket);

    List<Map<String, Object>> getFiles(String bucket);
}